﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;


namespace DataClass
{
    class ASConfig
    {
        string serverName = "";
        string databaseName = "";
        string timeOut = "";
        string portNo = "";

        internal ASConfig()
        {

            serverName = ConfigurationManager.AppSettings["Server"];
            databaseName = ConfigurationManager.AppSettings["Database"];
            timeOut = ConfigurationManager.AppSettings["Timeout"];
            portNo = ConfigurationManager.AppSettings["PortNo"];
        }

        internal string GetConnectionString()
        {
            string connectionString = "";
            connectionString = "workstation id=HOTELG07.mssql.somee.com;packet size=4096;user id=hoanghuyqn_SQLLogin_1;pwd=t74cr94u6j;data source=HOTELG07.mssql.somee.com;persist security info=False;initial catalog=HOTELG07";
            if (timeOut != null && timeOut.Equals(""))
                connectionString += ";Connection Timeout=" + timeOut;
            if (portNo != null && !portNo.Equals(""))
                connectionString += ";Port=" + portNo;
            return connectionString;
        }

        internal string GetConnectionString(string userName, string passWord)
        {
            string connectionString = "";
            connectionString = "server=" + serverName + ";database=" + databaseName;
            connectionString += ";UID=" + userName + ";PWD=" + passWord;
            if (timeOut != null && timeOut.Equals(""))
                connectionString += ";Connection Timeout=" + timeOut;
            if (portNo != null && !portNo.Equals(""))
                connectionString += ";Port=" + portNo;
            return connectionString;
        }
    }
}
